#!/bin/bash
# 配置阿里云源

# 引入公共配置
source ./common.sh

base=/etc/yum.repos.d
rm -rf ${base}/CentOS-Base.repo ${base}/epel.repo

echo "添加阿里云源"
curl -so /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
if [ $? -ne 0 ]; then
    error_exit "下载CentOS-Base.repo失败"
    exit 1;
fi

curl -so /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
if [ $? -ne 0 ]; then
    error_exit "下载epel.repo失败"
    exit 1;
fi

success_msg "阿里云源配置完成"
yum clean all
yum makecache fast
echo "安装常用工具"
yum install -y ntp  wget curl bind-utils htop  psmisc  gcc gcc-c++ make bzip2 epel-release lsof lrzsz telnet traceroute tcptraceroute net-tools bash-completion vim yum-utils yum-plugin-versionlock python3-pip git sshpass mtr conntrack-tools libseccomp libtool-ltdl device-mapper-persistent-data lvm2 conntrack ipvsadm ipset jq sysstat iotop iftop htop tree glances fio nc chrony haproxy unzip zip libffi-devel > /dev/null
ntpdate pool.ntp.org > /dev/null
timedatectl set-timezone Asia/Shanghai